package es.deusto.ingenieria.is.gemas;

import java.util.ArrayList;
import java.util.List;

import es.deusto.ingenieria.is.csp.formulation.Variable;

public class Ranura extends Variable<Gema>{
	private static final int numeroSecciones = 3;
	private static final int gemasPorSeccion = 4;
	
	private static List<Ranura> ranuras;
	private int numero;
	
	public Ranura(String name, List<Gema> domain) {
		super(name, domain);
		numero = Integer.valueOf(name);
	} 
	
	public int getNumero(){
		return numero;
	}
	
	public static List<Ranura> colocarGemas(List<Gema> gemas){
		ranuras = new ArrayList<Ranura>();
		for (int i = 0; i < numeroSecciones*gemasPorSeccion; i++){
			ranuras.add(new Ranura(Integer.toString(i), gemas));
		}
		return ranuras;
	}
	
	public static List<Ranura> getRanuras(){
		return ranuras;
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder("Ranura ");
		sb.append(numero).append(": ").append(this.getValue());
		return sb.toString();
	}
}
